<?php
namespace Api\Controller;
use Think\Controller;
class IndexController extends BaseController{
	/**
	*获取医生列表 get
	*@param: 
	*@return:
	*/
	public function doctors(){
	  $data = M('doctor')
	  ->join('picture p1 on p1.id = doctor.avatar','left')
	  ->field('doctor.*,p1.path as head_path')
	  ->select();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取医生详情 get
	*@param: 
	*@return:
	*/
	public function doctorDetail(){
	  $id=I('get.id');
			
	  $data = M('doctor')
	  ->where(array('doctor.id'=>$id))
	  ->join('picture p1 on p1.id = doctor.avatar','left')
	  ->field('doctor.*,p1.path as head_path')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取中心介绍 get
	*@param: 
	*@return:
	*/
	public function office(){
	  $data = M('office')
	  ->field('office.content')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取新闻列表 get
	*@param: 
	*@return:
	*/
	public function news(){
	  $data = M('news')
	  ->join('picture p1 on p1.id = news.cover','left')
	  ->field('news.*,p1.path as cover_path')
	  ->select();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取新闻详情 get
	*@param: 
	*@return:
	*/
	public function newsDetail(){
	  $id=I('get.id');
			
	  $data = M('news')
	  ->where(array('news.id'=>$id))
	  ->join('picture p1 on p1.id = news.cover','left')
	  ->field('news.*,p1.path as cover_path')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取尿毒症 get
	*@param: 
	*@return:
	*/
	public function ndz(){
	  $data = M('ndz')
	  ->field('ndz.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取了解肾移植 get
	*@param: 
	*@return:
	*/
	public function ljsyz(){
	  $id=I('get.id');
			
	  $data = M('ljsyz')
	  ->where(array('ljsyz.id'=>$id))
	  ->field('ljsyz.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取肾移植过程 get
	*@param: 
	*@return:
	*/
	public function syzgc(){
	  $id=I('get.id');
			
	  $data = M('syzgc')
	  ->where(array('syzgc.id'=>$id))
	  ->field('syzgc.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取常见问题 get
	*@param: 
	*@return:
	*/
	public function getQuestion(){
	  $id=I('get.id');
			
	  $data = M('normal_question')
	  ->where(array('normal_question.id'=>$id))
	  ->field('normal_question.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取入院指南列表 get
	*@param: 
	*@return:
	*/
	public function getryzn(){	
	  $data = M('ryzn')
	  ->field('ryzn.id,ryzn.title')
	  ->select();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取入院指南详情 get
	*@param: 
	*@return:
	*/
	public function ryznDetail(){
	  $id=I('get.id');
			
	  $data = M('ryzn')
	  ->where(array('ryzn.id'=>$id))
	  ->field('ryzn.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取院内指导列表 get
	*@param: 
	*@return:
	*/
	public function getynzd(){	
	  $data = M('ynzd')
	  ->field('ynzd.id,ynzd.title')
	  ->select();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取院内指导详情 get
	*@param: 
	*@return:
	*/
	public function ynzdDetail(){
	  $id=I('get.id');
			
	  $data = M('ynzd')
	  ->where(array('ynzd.id'=>$id))
	  ->field('ynzd.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取出院指南列表 get
	*@param: 
	*@return:
	*/
	public function getcyzn(){	
	  $data = M('cyzn')
	  ->field('cyzn.id,cyzn.title')
	  ->select();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取出院指南详情 get
	*@param: 
	*@return:
	*/
	public function cyznDetail(){
	  $id=I('get.id');
			
	  $data = M('cyzn')
	  ->where(array('cyzn.id'=>$id))
	  ->field('cyzn.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取院外指导列表 get
	*@param: 
	*@return:
	*/
	public function getywzd(){	
	  $data = M('ywzd')
	  ->field('ywzd.id,ywzd.title')
	  ->select();

	  $this->response(array('info'=>$data),json,200);
	}

	/**
	*获取院外指导详情 get
	*@param: 
	*@return:
	*/
	public function ywzdDetail(){
	  $id=I('get.id');
			
	  $data = M('ywzd')
	  ->where(array('ywzd.id'=>$id))
	  ->field('ywzd.*')
	  ->find();

	  $this->response(array('info'=>$data),json,200);
	}
}